package com.kupurui.asteacher.utils;

import android.os.CountDownTimer;
import android.widget.TextView;

/**
 * Created by pmj on 2017/5/11.
 */

public class MyCount extends CountDownTimer {

    private TextView tvVerify;

    public MyCount(long millisInFuture, long countDownInterval, TextView tvVerify) {
        super(millisInFuture, countDownInterval);
        this.tvVerify = tvVerify;
    }

    @Override
    public void onTick(long l) {
        if (tvVerify == null)
            return;
        tvVerify.setEnabled(false);
        tvVerify.setText(l/1000+"s");
    }

    @Override
    public void onFinish() {
        if (tvVerify == null)
            return;
        tvVerify.setEnabled(false);
        tvVerify.setText("发送验证码");
    }
}
